/*
 * @Descripttion:
 * @Author: voanit
 * @Date: 2022-09-01 11:56:43
 * @LastEditors: voanit
 * @LastEditTime: 2022-09-01 15:12:21
 */
import { defineStore } from 'pinia'
const useCounterStore = defineStore('counter', {
  state: () => {
    return {
      count: 1,
      arr: [1, 2, 3, 4, 5],
    }
  },
  actions: {
    double() {
      this.count = this.count * 2
      console.log(this.count, 99)
      this.arr.push(this.count)
    },
  },
  getters: {
    total() {
      // console.log(this, 99)
      return this.arr.reduce((sum, item) => sum + item, 0)
    },
  },
})

export default useCounterStore
